package com.zxq.ai.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

@Getter
@AllArgsConstructor
public enum RewardRedeemTaskStatus {

    INIT(0, "初始化"),
    DOING(10, "发放中"),
    SUCCESS(20, "发放成功"),
    FAIL(30, "发放失败，待重试"),
    ;

    private final Integer code;
    private final String desc;

    public static RewardRedeemTaskStatus getByCode(Integer code) {
        if (Objects.isNull(code)) {
            return null;
        }

        for (RewardRedeemTaskStatus value : RewardRedeemTaskStatus.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}
